


// String      字符串
// Number      数字    
// Date        日期
// Buffer      二进制
// Boolean     布尔值
// Mixed       混合类型
// ObjectId    对象ID    
// Array       数组

const mongoose = require('mongoose');
const Schema = mongoose.Schema

const user_schema = new Schema({
    username:String,
    age:Number,
    password:String,
    phone:String,
    email:String,
    address:String,
    time:Date,
    role:Number,  // 0 普通用户  1保安  2. 物业  3管理员
    avatar:String 
})
exports.user_model = mongoose.model('users',user_schema) 

const movie_schema = new Schema({
  "genres" :Array, 
  "casts" : Array, 
  "directors" :Array, 
  "rating" : Object, 
  "title" : String, 
  "collect_count" : Number, 
  "original_title" : String, 
  "subtype" : String, 
  "year" : String, 
  "images" :Object, 
  "alt" :String,
  "id" : String
})
exports.movie_model = mongoose.model('movies',movie_schema) // movie=> movies 

const comment_schema = new Schema({
  id:Number,
  title:String,
  content:String,
})
exports.comment_model = mongoose.model('comments',comment_schema)  


// 公告
const anno_schema = new Schema({
  id:Number,
  title:String,
  content:String,
  type:Number,  // 1 普通公告 2. 重要公告   3. 紧急公告  
  desc:String, // 图片 
  time:Date,
  author:String , // 发布人 
})
exports.anno_model  = mongoose.model('annos',anno_schema)  